//
//  JYStatusBottomView.swift
//  01.weibo
//
//  Created by 谢玉锋 on 16/7/16.
//  Copyright © 2016年 itheima.cn. All rights reserved.
//

import UIKit

class JYStatusBottomView: UIView {
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor.orangeColor()
        prepareUI()
    }

    private func prepareUI(){
    
        //添加子控件
        addSubview(retweeButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(sepImageViewFirst)
        addSubview(sepImageViewSecond)
        //添加约束
        //转发
        retweeButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
        }
        //评论
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(retweeButton.snp_trailing)
            make.top.bottom.equalTo(self)
            
            make.width.equalTo(retweeButton.snp_width)
        }
        //赞
        likeButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commentButton.snp_trailing)
            make.top.bottom.trailing.equalTo(self)
            
            make.width.equalTo(retweeButton.snp_width)
        }
        //分割线1
        sepImageViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(retweeButton)
            make.centerX.equalTo(retweeButton.snp_trailing)
        }
        //分割线2
        sepImageViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerY.equalTo(commentButton)
            make.centerX.equalTo(commentButton.snp_trailing)
        }
        
        
    }
    //懒加载子控件
    private lazy var retweeButton: UIButton = UIButton(Img: "timeline_icon_retweet", title: "转发")
//    private lazy var retweeButton: UIButton = {
//        let button = UIButton()
//        // 设置按钮背景图片
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        // 设置按钮图片
//        button.setImage(UIImage(named: "timeline_icon_retweet"), forState: UIControlState.Normal)
//        //设置题标
//        button.setTitle("转发", forState: UIControlState.Normal)
//        return button
//    }()
    private lazy var commentButton: UIButton = UIButton(Img: "timeline_icon_comment", title: "评论")
//    private lazy var commentButton: UIButton = {
//    let button = UIButton()
//        // 设置按钮背景图片
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        // 设置按钮图片
//        button.setImage(UIImage(named: "timeline_icon_comment"), forState: UIControlState.Normal)
//        //设置题标
//        button.setTitle("评论", forState: UIControlState.Normal)
//        return button
//    }()
    private lazy var likeButton: UIButton = UIButton(Img: "timeline_icon_unlike", title: "赞")
//    private lazy var likeButton: UIButton = {
//        let button = UIButton()
//        // 设置按钮背景图片
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background"), forState: UIControlState.Normal)
//        button.setBackgroundImage(UIImage(named: "timeline_card_bottom_background_highlighted"), forState: UIControlState.Highlighted)
//        // 设置按钮图片
//        button.setImage(UIImage(named: "timeline_icon_unlike"), forState: UIControlState.Normal)
//        //设置题标
//        button.setTitle("赞", forState: UIControlState.Normal)
//        return button
//    }()
    
    //分割线1
    private lazy var sepImageViewFirst: UIImageView = UIImageView(imgName: "timeline_card_bottom_line")
    //分割线2
     private lazy var sepImageViewSecond: UIImageView = UIImageView(imgName: "timeline_card_bottom_line")
}







